package com.example.aop.service;

import org.aspectj.lang.ProceedingJoinPoint;

/**
 * ClassName:TimerAspect
 * Package:com.example.aop.service
 * Description:
 *
 * @Author:ZhangXin
 * @Create:2023/5/11-8:59
 * @Version:v1.0
 */
public class TimerAspect {

    //通知
    public void aroundAdvice(ProceedingJoinPoint joinPoint) throws Throwable {
        //前环绕
        long begin = System.currentTimeMillis();
        //调用目标
        joinPoint.proceed();
        //后环绕
        long end = System.currentTimeMillis();
        System.out.println("耗时"+(end-begin)+"毫秒");
    }
}
